/*
 * Copyright (c) GuCeo Inc. All Rights Reserved.
 */

package util.location.tencent;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import util.http.HttpUtil;

import java.math.BigDecimal;

/**
 * @author yangfan
 * @description 百度和腾讯地图坐标转换
 * @date 2018/5/22 13:54
 **/

public class TranslateLocationUtil {

	private static final Logger LOGGER = LoggerFactory.getLogger(TranslateLocationUtil.class);

	/**
	 * 坐标转换
	 *
	 * @param type      1 GPS坐标 2 sogou经纬度 3 baidu经纬度 4 mapbar经纬度 5 [默认]腾讯、google、高德坐标 6 sogou墨卡托
	 * @param longitude
	 * @param latitude
	 * @return
	 */
	public static TecentLocationJson translateBaiduToTecent(Byte type, BigDecimal longitude, BigDecimal latitude) {
		String url = "http://apis.map.qq.com/ws/coord/v1/translate?locations=" + latitude.toString() + "," + longitude.toString()
				+ "&type=3&key=TMWBZ-TWUKO-752WO-SFAIT-COAFO-UBF6P";
		LOGGER.debug("request url is {}.", url);
		String locationJson = HttpUtil.httpGet(url);
		System.out.println(locationJson);
		//        return JsonUtil.objectFromJSONString(locationJson, TecentLocationJson.class);
		return null;
	}
}
